package cn.edu.lingnan.tourism.mapper;

import cn.edu.lingnan.tourism.pojo.User;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface UserMapper extends Mapper<User> {
    //根据uid和邮箱修改用户密码
    @Update("update tab_user set password=#{nowPassword} where uid=#{uid} and email=#{email}")
    public int updateUserPasswordByEmailUid(String nowPassword,int uid,String email);
    //模糊查询
    @Select("select * from tab_user where username like CONCAT('%',#{str},'%') or `name` like CONCAT('%',#{str},'%') or `sex` like CONCAT('%',#{str},'%') or `email` like CONCAT('%',#{str},'%')")
    public List<User> selectUserByString(String str);
    //查询用户总数
    @Select("SELECT count(uid) from tab_user")
    public Integer selectUseCount();
}
